<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <!-- 引入vue.js -->
    <script type="text/javascript" src="../js/vue.min.js"></script>
    <link rel="stylesheet" href="../css/my-components.css">
    <!-- 引入自定义组件文件 -->
    <script src="my/my-components.js"></script>
    <title>组件示例</title>
    <style type="text/css">
      a{
        color:white;
        font-size: 18px;
        background: tomato;
        border: yellowgreen 1px solid;
        padding: 3px 5px;
        text-decoration: none;
        border-radius: 3px;
      }
      a:hover{
        background:yellowgreen;
        color: steelblue;
      }
    </style>
  </head>

  <body>
    <div id="app">
      <!-- 只有在vue的范围内才能使用组件 -->
      <header-bar>
        <div>
          <a href="#">首页</a>
          <a href="#">首页</a>
          <a href="#">首页</a>
          <a href="#">首页</a>
        </div>
      </header-bar>
    </div>
    <script type="text/javascript">
      var vue = new Vue({
        el: "#app",
        data: {
          name: "liuyadi",
        },
        methods: {
          test2: function () {
            alert("这是Vue实例中的函数");
          },
        },
      });
    </script>
  </body>
</html>
